home *** CD-ROM | disk | FTP | other *** search
- package bugbug;
-
- import javax.microedition.lcdui.Canvas;
- import javax.microedition.lcdui.Form;
- import javax.microedition.lcdui.Graphics;
- import javax.microedition.lcdui.Image;
-
- class YopparaiCanvas extends Canvas implements Runnable {
- // $FF: renamed from: I bugbug.BugBug
- private BugBug field_0;
- // $FF: renamed from: Z javax.microedition.lcdui.Form
- private Form field_1;
- private static String Code;
- private static int init;
- private static int keyReleased;
- public static int proc;
- private static int keyPressed;
- private static Graphics keyRepeated;
- public static int mode;
- private static int move;
- private static int paint;
- private static int run;
- private static int append;
- private static int toString;
- private static int createImage = 51;
- private static int getWidth;
- private static int getHeight;
- private static int[] out;
- private static int[] println;
- public static boolean thread_state;
- private static int getGraphics;
- private static int drawImage;
- private static int setColor;
- private static int fillRect;
- // $FF: renamed from: gc int
- private static int field_2;
- private static int getGameAction;
- private static int rand;
- private static int abs;
- private static int drawLine;
- private static int drawString;
- private static int setLocalHighscore;
- private static int saveHighscore;
- private static int[] checkInetHighscore;
- private static int[] repaint;
- private static int[] yield;
- private static int sleep;
- // $FF: renamed from: A javax.microedition.lcdui.Image[]
- private static Image[] field_3;
- // $FF: renamed from: B javax.microedition.lcdui.Image[]
- private static Image[] field_4;
- // $FF: renamed from: C javax.microedition.lcdui.Image
- private static Image field_5;
- // $FF: renamed from: D javax.microedition.lcdui.Image
- private static Image field_6;
- // $FF: renamed from: E javax.microedition.lcdui.Graphics
- private static Graphics field_7;
- // $FF: renamed from: F javax.microedition.lcdui.Graphics
- private static Graphics field_8;
- // $FF: renamed from: G boolean
- private boolean field_9 = false;
- // $FF: renamed from: H javax.microedition.lcdui.Image[]
- private static Image[] field_10;
- // $FF: renamed from: J javax.microedition.lcdui.Image[]
- private static Image[] field_11;
-
- public YopparaiCanvas(BugBug var1) {
- this.field_0 = var1;
-
- try {
- for(getWidth = 0; getWidth < 10; ++getWidth) {
- field_10[getWidth] = Image.createImage("/bugbug/" + getWidth + ".png");
- field_11[getWidth] = Image.createImage(field_10[getWidth].getWidth(), field_10[getWidth].getHeight());
- }
- } catch (Exception var4) {
- System.out.println("Exception: " + var4);
- }
-
- this.init();
-
- try {
- field_5 = Image.createImage(((Canvas)this).getWidth() + 1, ((Canvas)this).getHeight());
- field_6 = Image.createImage(((Canvas)this).getWidth() + 1, ((Canvas)this).getHeight());
- field_7 = field_5.getGraphics();
- field_8 = field_6.getGraphics();
- field_8.drawImage(field_10[6], 0, 0, 20);
- field_8.drawImage(field_10[6], field_10[6].getWidth(), 0, 20);
- field_7.drawImage(field_10[6], 0, 0, 20);
- field_7.drawImage(field_10[6], field_10[6].getWidth(), 0, 20);
- field_8.drawImage(field_10[7], 0, field_10[6].getHeight() + 6, 20);
- field_8.drawImage(field_10[7], field_10[6].getWidth(), field_10[6].getHeight() + 6, 20);
- field_7.drawImage(field_10[7], 0, field_10[6].getHeight() + 6, 20);
- field_7.drawImage(field_10[7], field_10[6].getWidth(), field_10[6].getHeight() + 6, 20);
- field_8.setColor(0);
- field_8.fillRect(0, (75 - toString) / 2 + 4 + 10, ((Canvas)this).getWidth(), toString - 10);
- } catch (Exception var3) {
- System.out.println("Exception: " + var3);
- }
-
- }
-
- public void init() {
- this.field_9 = false;
- System.gc();
- mode = 0;
- Code = "";
- proc = 0;
- keyReleased = 0;
- init = 20;
- keyPressed = 0;
- drawImage = 0;
- setColor = 0;
- fillRect = 0;
- abs = 0;
- rand = 1;
- drawLine = 1;
- move = 0;
- paint = 15;
- run = 50;
- toString = 65;
-
- try {
- field_8.setColor(255, 255, 255);
- field_8.fillRect(0, 0, ((Canvas)this).getWidth() + 1, ((Canvas)this).getHeight());
- field_7.setColor(255, 255, 255);
- field_7.fillRect(0, 0, ((Canvas)this).getWidth() + 1, ((Canvas)this).getHeight());
- field_8.setColor(0);
- field_8.drawImage(field_10[6], 0, 0, 20);
- field_8.drawImage(field_10[6], field_10[6].getWidth(), 0, 20);
- field_7.drawImage(field_10[6], 0, 0, 20);
- field_7.drawImage(field_10[6], field_10[6].getWidth(), 0, 20);
- field_8.drawImage(field_10[7], 0, field_10[6].getHeight() + 6, 20);
- field_8.drawImage(field_10[7], field_10[6].getWidth(), field_10[6].getHeight() + 6, 20);
- field_7.drawImage(field_10[7], 0, field_10[6].getHeight() + 6, 20);
- field_7.drawImage(field_10[7], field_10[6].getWidth(), field_10[6].getHeight() + 6, 20);
- field_8.fillRect(0, (75 - toString) / 2 + 4 + 10, ((Canvas)this).getWidth(), toString - 10);
- } catch (Exception var2) {
- }
-
- for(getWidth = 0; getWidth < createImage; ++getWidth) {
- out[getWidth] = (75 - toString) / 2 + 4;
- println[getWidth] = out[getWidth] + toString;
- }
-
- append = 0;
-
- for(getWidth = 0; getWidth < saveHighscore; ++getWidth) {
- yield[getWidth] = 0;
- }
-
- thread_state = true;
- }
-
- public void keyReleased(int var1) {
- if (proc == 1) {
- int var2 = ((Canvas)this).getGameAction(var1);
- if (var2 == 1) {
- keyPressed = 0;
- }
- }
-
- }
-
- public void keyPressed(int var1) {
- if (thread_state) {
- if (proc == 0) {
- proc = 1;
- fillRect = 0;
- } else if (proc == 1) {
- int var2 = ((Canvas)this).getGameAction(var1);
- if (var2 == 1) {
- keyPressed = 1;
- }
- }
- }
-
- }
-
- public void keyRepeated(int var1) {
- if (proc == 1) {
- int var2 = ((Canvas)this).getGameAction(var1);
- if (var2 == 1) {
- this.keyPressed(var1);
- }
- }
-
- }
-
- public void move() {
- if (proc == 1) {
- init += keyReleased;
- if (keyPressed != 0) {
- keyReleased -= 2;
- }
-
- ++keyReleased;
- }
-
- }
-
- public void paint(Graphics var1) {
- switch (proc) {
- case 0:
- var1.setColor(0);
- var1.fillRect(0, 0, ((Canvas)this).getWidth(), ((Canvas)this).getHeight());
- var1.drawImage(field_10[8], ((Canvas)this).getWidth() / 2, 15, 17);
- var1.drawImage(field_10[9], ((Canvas)this).getWidth() / 2, 60, 17);
- var1.setColor(0);
- break;
- case 1:
- move = (move + 1) % createImage;
- paint = (paint + 1) % createImage;
- run = (run + 1) % createImage;
- if (move == 0) {
- drawLine = (drawLine + 1) % 2;
- if (drawLine == 0) {
- field_8.setColor(255, 255, 255);
- field_8.fillRect(0, 0, ((Canvas)this).getWidth() + 1, ((Canvas)this).getHeight());
- field_8.drawImage(field_10[6], 0, 0, 20);
- field_8.drawImage(field_10[6], field_10[6].getWidth(), 0, 20);
- field_8.drawImage(field_10[7], 0, field_10[6].getHeight() + 6, 20);
- field_8.drawImage(field_10[7], field_10[6].getWidth(), field_10[6].getHeight() + 6, 20);
- } else {
- field_7.setColor(255, 255, 255);
- field_7.fillRect(0, 0, ((Canvas)this).getWidth() + 1, ((Canvas)this).getHeight());
- field_7.drawImage(field_10[6], 0, 0, 20);
- field_7.drawImage(field_10[6], field_10[6].getWidth(), 0, 20);
- field_7.drawImage(field_10[7], 0, field_10[6].getHeight() + 6, 20);
- field_7.drawImage(field_10[7], field_10[6].getWidth(), field_10[6].getHeight() + 6, 20);
- }
- }
-
- getGraphics = (short)(Rand.rand() % 5) - out[(run - 1 + createImage) % createImage] / ((75 - toString) / 5);
- append += getGraphics;
- if (append > 3 + rand % 20 / 4) {
- --append;
- } else if (append < -3 - rand % 20 / 4) {
- ++append;
- }
-
- if (out[(run - 1 + createImage) % createImage] < 0) {
- append = Math.abs(append);
- } else if (out[(run - 1 + createImage) % createImage] > 75 - toString) {
- append = -Math.abs(append);
- }
-
- out[run] = out[(run - 1 + createImage) % createImage] + append / 2;
- println[run] = out[run] + toString;
- if (move == 0) {
- if (drawLine == 0) {
- field_7.drawLine(((Canvas)this).getWidth() - 1, out[50] + 10, ((Canvas)this).getWidth() - 1, println[50]);
- } else {
- field_8.drawLine(((Canvas)this).getWidth() - 1, out[50] + 10, ((Canvas)this).getWidth() - 1, println[50]);
- }
- }
-
- field_8.setColor(0);
- field_7.setColor(0);
- if (drawLine == 0) {
- if (move != 0) {
- field_8.drawLine(2 * run + 1, out[run % createImage] + 10, 2 * run + 1, println[run % createImage]);
- field_8.drawLine(2 * run, (out[run % createImage] + out[(run - 1 + createImage) % createImage]) / 2 + 10, 2 * run, (println[run % createImage] + println[(run - 1 + createImage) % createImage]) / 2);
- }
- } else if (move != 0) {
- field_7.drawLine(2 * run + 1, out[run % createImage] + 10, 2 * run + 1, println[run % createImage]);
- field_7.drawLine(2 * run, (out[run % createImage] + out[(run - 1 + createImage) % createImage]) / 2 + 10, 2 * run, (println[run % createImage] + println[(run - 1 + createImage) % createImage]) / 2);
- }
-
- if (drawLine == 0) {
- var1.drawImage(field_5, -move * 2, 0, 20);
- var1.drawImage(field_6, ((Canvas)this).getWidth() - move * 2, 0, 20);
- } else {
- var1.drawImage(field_6, -move * 2, 0, 20);
- var1.drawImage(field_5, ((Canvas)this).getWidth() - move * 2, 0, 20);
- }
-
- if (keyReleased < -2) {
- var1.drawImage(field_10[0], 30, init + 10, 20);
- } else if (-2 <= keyReleased && keyReleased <= 2) {
- var1.drawImage(field_10[1], 30, init + 10, 20);
- } else {
- var1.drawImage(field_10[2], 30, init + 10, 20);
- }
-
- for(getWidth = 0; getWidth < saveHighscore; ++getWidth) {
- if (yield[getWidth] >= 1) {
- var1.drawImage(field_10[3], (createImage - move + repaint[getWidth]) % createImage * 2, checkInetHighscore[getWidth] + getHeight * 6, 20);
- }
- }
-
- if (init + 8 < out[paint] || println[paint] < init + 14) {
- var1.drawString("Game Over!", ((Canvas)this).getWidth() / 2, ((Canvas)this).getHeight() / 2, 17);
- proc = 2;
- }
-
- for(getWidth = 0; getWidth < saveHighscore; ++getWidth) {
- if (yield[getWidth] >= 1 && paint <= repaint[getWidth] && repaint[getWidth] <= paint + 3 && checkInetHighscore[getWidth] - 10 < init + 10 && init + 10 < checkInetHighscore[getWidth] + 7) {
- var1.drawString("Game Over!", ((Canvas)this).getWidth() / 2, ((Canvas)this).getHeight() / 2, 17);
- proc = 2;
- }
- }
-
- var1.drawString("S " + abs + " L " + rand / 2, 0, 0, 20);
- if (setLocalHighscore % 23 - rand / 20 % 6 * 2 == 0) {
- if (0 < rand % 20 && rand % 20 <= 10) {
- yield[sleep] = (short)(Rand.rand() % (rand / 20 + 1)) % 4 + 1;
- }
-
- if (yield[sleep] <= 3) {
- repaint[sleep] = run;
- } else if (yield[sleep] == 4) {
- repaint[sleep] = move;
- }
-
- checkInetHighscore[sleep] = (short)(Rand.rand() % 55) + 10;
- if (sleep < saveHighscore - 1) {
- ++sleep;
- } else {
- sleep = 0;
- }
- }
-
- for(getWidth = 0; getWidth < saveHighscore; ++getWidth) {
- if (1 <= yield[getWidth] && yield[getWidth] <= 3 && repaint[getWidth] == move || yield[getWidth] == 4 && (repaint[getWidth] == run || repaint[getWidth] == run - 1)) {
- yield[getWidth] = 0;
- }
-
- if (yield[getWidth] == 2) {
- checkInetHighscore[getWidth] = (checkInetHighscore[getWidth] + 2) % 80;
- } else if (yield[getWidth] == 3) {
- repaint[getWidth] = (repaint[getWidth] - 1 + createImage) % createImage;
- } else if (yield[getWidth] == 4) {
- repaint[getWidth] = (repaint[getWidth] + 2) % createImage;
- }
- }
-
- ++setLocalHighscore;
- ++abs;
- if (abs % 7 == 0) {
- ++rand;
- }
-
- if (rand % 20 > 9 && toString > 35) {
- --toString;
- } else if (rand % 20 <= 9 && toString < 65) {
- ++toString;
- }
-
- var1.setColor(1);
- var1.drawString(Code, 10, 10, 17);
- break;
- case 2:
- var1.setColor(255, 255, 255);
-
- for(getWidth = 0; getWidth < 5; ++getWidth) {
- var1.drawLine(34, init + 10 + 4, 34 + (short)(Rand.rand() % 150) - 75, init + 10 + 4 + (short)(Rand.rand() % 150) - 75);
- }
-
- var1.drawString("S " + abs + " L " + rand, 0, 0, 20);
- var1.drawString("Game Over!", ((Canvas)this).getWidth() / 2, ((Canvas)this).getHeight() / 2, 17);
- if (this.field_9) {
- var1.drawString("HiScore!!", ((Canvas)this).getWidth() / 2, ((Canvas)this).getHeight() / 2, 33);
- }
-
- ++drawImage;
- if (drawImage > 30) {
- if (this.field_9) {
- thread_state = false;
- this.field_0.setLocalHighscore(abs);
- this.field_0.saveHighscore();
- this.field_0.checkInetHighscore();
- } else {
- this.init();
- }
- }
- }
-
- }
-
- public void run() {
- while(true) {
- if (thread_state) {
- this.move();
- ((Canvas)this).repaint();
- }
-
- try {
- Thread.yield();
- Thread.sleep(80L);
- } catch (InterruptedException var2) {
- }
- }
- }
-
- static {
- out = new int[createImage];
- println = new int[createImage];
- saveHighscore = 30;
- checkInetHighscore = new int[saveHighscore];
- repaint = new int[saveHighscore];
- yield = new int[saveHighscore];
- field_3 = new Image[10];
- field_4 = new Image[10];
- field_10 = new Image[10];
- field_11 = new Image[10];
- }
- }
-